/**
 * 
 */
package com.usc.entme;

import java.net.MalformedURLException;
import java.net.URL;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

/**
 * This is the model object for the Message parsing for the RSS reader
 * 
 * @author Dhruvil
 *
 */
public class Message implements Parcelable {

	private String title;
	private URL link;
	private String description;
	private String img;
	private String TAG = "Message1";

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		
		Log.d(TAG,"title : " + title);
		this.title = title.trim();
	}

	public URL getLink() {
		return link;
	}

	public void setLink(String link) {
		Log.d(TAG,"link : " + link);
		try {
			this.link = new URL(link);
		} catch (MalformedURLException e) {
			throw new RuntimeException(e);
		}
	}

	public void setImg(String img1)
	{
		Log.d(TAG,"img : " + img1);
		this.img = img1.trim();
	
	}
	
	public String getImg() {
		return img;
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		Log.d(TAG ,"description  : " + description);
		this.description = description.trim();
	}

	public Message copy(){
		Message copy = new Message();
		copy.title = title;
		copy.link = link;
		copy.description = description;
		copy.img = img;
		//copy.date = date;
		return copy;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Title: ");
		sb.append(title);
		sb.append('\n');
		//	sb.append("Date: ");
		//	sb.append(this.getDate());
		sb.append('\n');
		sb.append("Link: ");
		sb.append(link);
		sb.append('\n');
		sb.append("Description: ");
		sb.append(description);
		
		sb.append('\n');
		sb.append("Image: ");
		sb.append(img);
		return sb.toString();
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		
	}


}
